import { defineStore } from 'pinia';
import { login } from "@/API/login-API";
import { showSuccessToast } from 'vant';

export const useLogin = defineStore('loginStore',{
    state:():any => {

    },
    getters:{},
    actions:{
        async handleLogin(loginname:string,password:string) {
            const res:any = await login(loginname,password)
            console.log(res);
            if(res.code === '200') {
                localStorage.setItem('token',res.data.token)
                showSuccessToast(res.message);
            }
            
        }
    }
})